<%@ page language="java" pageEncoding="utf-8"%>
<%@ taglib prefix="fn" uri="/WEB-INF/fn.tld"%>
<%@ taglib prefix="c" uri="/WEB-INF/c.tld"%>
<%@ taglib prefix="fmt" uri="/WEB-INF/fmt.tld"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String errorMsg = (String)request.getAttribute("errorMsg");
%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>医药快车--网上订单系统</title>
    
	<link href="css/default.css" rel="stylesheet" type="text/css" />
	<style type="text/css">  
       .code   
       {   
           background-image:url(code.jpg);   
           font-family:Arial;   
            font-style:italic;   
            color:Red;   
            border:0;   
            padding:2px 3px;   
            letter-spacing:3px;   
            font-weight:bolder;   
        }   
        .unchanged   
        {   
            border:0;   
        }   
    </style> 
    <link rel="stylesheet" type="text/css" href="js/themes/default/easyui.css" />
    <link rel="stylesheet" type="text/css" href="js/themes/icon.css" />
    <script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="js/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="js/locale/easyui-lang-zh_CN.js"></script>
  </head>
  <script language="javascript" type="text/javascript">  
       
     var code ; //在全局 定义验证码   
     function createCode()   
     {    
       code = "";   
       var codeLength = 4;//验证码的长度   
       var checkCode = document.getElementById("checkCode");   
       var selectChar = new Array(0,1,2,3,4,5,6,7,8,9);//所有候选组成验证码的字符，当然也可以用中文的   
           
       for(var i=0;i<codeLength;i++)   
       {   
         
           
       var charIndex = Math.floor(Math.random()*10);   
       code +=selectChar[charIndex];   
          
          
       }   
//       alert(code);   
       if(checkCode)   
       {   
         checkCode.className="code";   
         checkCode.value = code;   
       }   
          
     }   
        
      function validate ()   
     {   
       if($("frm").form('validate')==false)return false;
       var inputCode = document.getElementById("input1").value;   
       if(inputCode.length <=0)   
       {   
           //alert("请输入验证码！"); 
           $.messager.alert("Warning","请输入验证码！","warning");  
           return false;
       }   
       else if(inputCode != code )   
       {   
          //alert("验证码输入错误！");
          $.messager.alert("Error","验证码输入错误！","error");   
          createCode();//刷新验证码  
          return false;
       }   
       else   
       {   
         return true;  
       }   
          
     }   
          
    </script>
	<script type="text/javascript">
		function init(){
			createCode();
		    var em = "<%=errorMsg%>";
		    if(em != null && em != "null")
		    alert(em);
			document.getElementById("userId").focus();
		}
	</script>
  <body  onload="init()">
  
    <div id="w" class="easyui-window" title="医药快车网上订单系统--登陆" collapsible="false" minimizable="false"
        maximizable="false" icon="icon-save"  style="width: 300px; height: 300px; padding: 5px;
        background: #fafafa;">
        <div class="easyui-layout" fit="true">
            <div region="center" border="false" style="padding: 10px; background: #fff; border: 1px solid #ccc;">
            	<form id='frm' action="userAction_login.do"  onsubmit="return validate()">
	                <table cellpadding=3>
	                	<tr>
	                        <td>帐套：</td>
	                        <td>
	                        	<SELECT name='corpcode'>
	                        		<c:forEach var="c" items="${corpList}">
		                        		<option value="${c.corpcode}">${c.corpname}</option>
	                        		</c:forEach>
	                        	</SELECT>
	                        </td>
	                    </tr>
	                    <tr>
	                        <td>用户名：</td>
	                        <td><input name="loginID" type="text" class="easyui-validatebox" required="true"/>
	                        </td>
	                    </tr>
	                    <tr>
	                        <td>密码：</td>
	                        <td><input name="psw" type="Password" class="easyui-validatebox" required="true"/></td>
	                    </tr>
	                    <tr>
	                        <td>验证码：</td>
	                        <td>
                				<input  type="text"   id="input1" style="width: 50px" class="txt01" />
	                        	<input type="text" onclick="createCode()" readonly="readonly" id="checkCode" class="unchanged" style="width: 50px"  />
	                        </td>
	                    </tr>
	                </table>
                </form>
            </div>
            <div region="south" border="false" style="text-align: right; height: 30px; line-height: 30px;">
                <a id="btnEp" class="easyui-linkbutton" icon="icon-ok" href="javascript:void(0)" >登陆</a> 
                <a id="btnCancel" class="easyui-linkbutton" icon="icon-cancel" href="javascript:void(0)">重置</a>
            </div>
        </div>
    </div>
  </body>
</html>


<script type="text/javascript">
	$(function(){
		$('#w').window({
                title: '医药快车网上订单系统--登陆',
                width: 400,
                height: 220,
                modal: true,
                shadow: true,
                closable:false,
                resizable:false
            });
            
		$("#btnEp").click(function(){
			$("#frm").submit();
		});
		
		$("#btnCancel").click(function(){
			$("#frm").form("clear");
			createCode();
		});            
	});
</script>
